Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to scale and center objects inside the 3d object browser of the map editor #173

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brunoramoslu
Copy link
Contributor

There's something that has been bothering me for awhile now regarding the map editor 3d object browser.
The objects are not always visible, or not centered, in the 3d object browser.
From what I could understand from the code, the behavior depends on the size of the object.

I'm trying to play around with a scale factor to place the object inside the "canvas" always centered and scaled to fit the 3d browser window.

This is not finished yet, but I would like some comments if you have any 🙂
Also if you can test and confirm you see no issue it would be great.

Once we agree what would be the best approach to improve this I can rework the pull request.

@gvissers
Copy link
Collaborator

gvissers commented Jan 15, 2022

I agree, it is an annoying issue.

And I'm sorry, I haven't looked at this in much detail yet, but the first question that came to my mind was: what does draw_3d_object_in_browser() do different from draw_3d_object(), and can the issue not be solved more easily by appropriate glScale and/or glTranslate around the calls to draw_3d_object() in the browser window?

Also, my feeling is that it is more of a translation issue than a scaling issue. The objects are drawn in the upper half of the fields, leaving the lower half nearly empty aside from the object name. My gut feeling is that by lowering them a bit, most of them can be made to fit easily. But as I said, I haven't looked at it to closely.

EDIT: sigh. the scale factors are taken from browser.lst. Well if you want to do anything to improve this, base them on the actual object dimensions... Also, it looks like only the upper 150 of 200 pixels are used for the drawing the objects, I think you can use more than that as only 18 pixels are used for the text.

@brunoramoslu
Copy link
Contributor Author

Thank you for your comments, really helpful.

The code change was really an ugly rough approach to show that items can be aligned using this approach.

I'll refactor the code an bit and try to clean it up.
It should be better now, but it's still not ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants